<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // function sayHi() {
      //   //提升
      //   console.log(`${phrase}, ${user}`);
      // }

      /*
        函数被定义到除函数以外的地方-函数的提升
      */
      let phrase = 'Hello';
      if (true) {
        let user = 'John';
        const sayHi = function () {
          //提升
          console.log(`${phrase}, ${user}`);
        };
      }
      sayHi();
    </script>
  </body>
</html>
